<?php 
defined('IN_TS') or die('Access Denied.');

switch($ts){
	
	//组织列表
	case "list":
		
		$arrOrg = $new['user']->findAll('user_org');
		
		include template('admin/org_list');
		break;
	
	//组织修改
	case "do":
		
		$arrOrgName = $_POST['orgname'];

		
		//先清空
		$db->query("TRUNCATE TABLE `".dbprefix."user_org`");
		
		//后添加
		foreach($arrOrgName as $key=>$item){
			$orgname = trim($item);
			
			if($orgname){
				$new['user']->create('user_org',array(
					'orgname'=>$orgname,

				));
			}
		}
		
		//再生成缓存文件
		$arrOrg = $new['user']->findAll('user_org',null,null,'orgid,orgname');
		
		fileWrite('user_org.php','data',$arrOrg);
		$tsMySqlCache->set('user_org',$arrOrg);
		
		qiMsg("修改成功！");
		
		break;
	
}